{layout name="public/layout" /}
{include file='yxnavbar'}


<div class="main">
    {include file='../../plugin/gift/template/web/common_nav'}
    <div class="panel panel-info">
        <div class="panel-heading">当前数量： {$page_total}</div>
        <div class="panel-body">
            <form id="myform" action="./index.php" method="get" class="form-horizontal" role="form">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="{$_P['m']}" />
                <input type="hidden" name="do" value="web" />
                <input type="hidden" name="r" value="gift.fans" id="r" />
                {if $has_tuan_gift}
                <div class="form-group">
                    <label class="col-xs-1 col-sm-1 col-md-1 control-label">成团礼</label>
                    <div class="col-xs-11 col-sm-9 col-md-9">
                        {loop $tuan_gift $row}
                            <div class="btn-group">
                                <button class="btn btn-default">
                                      {$row['name']}
                                </button>
                                <a class="btn {if $classify=='tuan_gift' && $gift_id==$row['id'] && $status==1 } btn-primary {else} btn-default {/if}"  href="{php echo createWebUrlPlugin('gift.fans',array('themeid'=>$themeid,'classify'=>'tuan_gift','gift_id'=>$row['id'],'status'=>1));}">
                                       未核销 <span style="color: #ff0000">{$row['total']}</span>
                                </a>
                                <a class="btn {if $classify=='tuan_gift' && $gift_id==$row['id'] && $status==2 } btn-primary {else} btn-default {/if}"  href="{php echo createWebUrlPlugin('gift.fans',array('themeid'=>$themeid,'classify'=>'tuan_gift','gift_id'=>$row['id'],'status'=>2));}">
                                      已核销 <span style="color: #8ccdfb">{$row['exchange_total']}</span>
                                </a>
                            </div>
                        {/loop}
                    </div>
                </div>
                {/if}
                {if $has_invite_gift}
                <div class="form-group">
                    <label class="col-xs-1 col-sm-1 col-md-1 control-label">邀请礼</label>
                    <div class="col-xs-11 col-sm-9 col-md-9">
                            {loop $invite_gift $row}
                                <div class="btn-group">
                                    <button class="btn btn-default">
                                        {$row['name']}
                                    </button>
                                    <a class="btn {if $classify=='invite_gift' && $gift_id==$row['id'] && $status==1 } btn-primary {else} btn-default {/if}"  href="{php echo createWebUrlPlugin('gift.fans',array('themeid'=>$themeid,'classify'=>'invite_gift','gift_id'=>$row['id'],'status'=>1));}">
                                        未核销 <span style="color: #ff0000"> {$row['total']}</span>
                                    </a>
                                    <a class="btn {if $classify=='invite_gift' && $gift_id==$row['id'] && $status==2 } btn-primary {else} btn-default {/if}"  href="{php echo createWebUrlPlugin('gift.fans',array('themeid'=>$themeid,'classify'=>'invite_gift','gift_id'=>$row['id'],'status'=>2));}">
                                        已核销 <span style="color: #8ccdfb"> {$row['exchange_total']}</span>
                                    </a>
                                </div>
                            {/loop}
                    </div>
                </div>
                {/if}
                {if $has_help_gift}
                <div class="form-group">
                    <label class="col-xs-1 col-sm-1 col-md-1 control-label">邀请礼</label>
                    <div class="col-xs-11 col-sm-9 col-md-9">
                        {loop $help_gift $row}
                        <div class="btn-group">
                            <button class="btn btn-default">
                                {$row['name']}
                            </button>
                            <a class="btn {if $classify=='invite_gift' && $gift_id==$row['id'] && $status==1 } btn-primary {else} btn-default {/if}"  href="{php echo createWebUrlPlugin('gift.fans',array('themeid'=>$themeid,'classify'=>'help_gift','gift_id'=>$row['id'],'status'=>1));}">
                                未核销 <span style="color: #ff0000"> {$row['total']}</span>
                            </a>
                            <a class="btn {if $classify=='invite_gift' && $gift_id==$row['id'] && $status==2 } btn-primary {else} btn-default {/if}"  href="{php echo createWebUrlPlugin('gift.fans',array('themeid'=>$themeid,'classify'=>'help_gift','gift_id'=>$row['id'],'status'=>2));}">
                                已核销 <span style="color: #8ccdfb"> {$row['exchange_total']}</span>
                            </a>
                        </div>
                        {/loop}
                    </div>
                </div>
                {/if}

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-1 control-label">按员工</label>
                    <div class="col-sm-3 col-lg-3 col-md-3 col-xs-6">
                        <select class="form-control" name="workerid">
                            <option value="" >全部</option>
                            {loop $wlist $row}
                               <option value="{$row['workerid']}" {if $workerid == $row['workerid'] }selected="selected"{/if}>
                                   {if $row['workername']}
                                       {if $system['is_multiple_merchants']}{$row['companyname']}-{/if}
                                       {if $row['teamname']}{$row['teamname']}-{/if}
                                       {$row['workername']}
                                   {/if}
                               </option>
                            {/loop}
                        </select>
                    </div>
                </div>

                <div class="form-group clearfix">
                    <label class="col-xs-12 col-sm-3 col-md-1 control-label">关键字</label>
                    <div class="col-sm-4 col-xs-4 col-md-4">
                        <input class="form-control" name="search_data" placeholder="输入报名手机号、微信昵称、客资姓名" type="text" value="{$_P['search_data']}">
                    </div>
                    <div class="col-sm-3 col-lg-3 col-md-3 col-xs-6">
                        <button class="btn btn-primary"><i class="fa fa-search"></i> 搜索</button>
                        <input type="hidden" name="__token__" value="{$Request.token}"/>
                    </div>
                    <div class="col-sm-2 col-lg-2 col-md-2 col-xs-2">
                        <input class="btn btn-default" type="submit" name="export_submit" onclick="jump()" id="export_submit" value="导出参与用户">
                    </div>
                    {if count($themelist)>1 }
                    <div class="col-xs-12 col-sm-2 col-md-2">
                        <select onchange="submitForm();" class="form-control" name="themeid">
                            {loop $themelist $row}
                            <option value="{$row['id']}" {if $themeid == $row['id'] }selected="selected"{/if}>{$row['id']} - {php echo mb_substr($row['title'],0,8,'utf-8');}</option>
                            {/loop}
                        </select>
                    </div>
                    {else}
                    <input type="hidden" name="themeid" value="{$themeid}" />
                    {/if}
                </div>
            </form>
        </div>
    </div>
    <div class="tab-content">
        <div class="panel panel-default">
            <div class="panel-body table-responsive">
                <table class="table table-hover">
                    <thead class="navbar-inner">
                    <tr>
                        <th style="width: 50px">UID</th>
                        <th style="width: 100px">昵称</th>
                        <th style="width: 100px">姓名/电话</th>
                        {if $has_tuan_gift}
                            <th style="width: 130px">成团礼</th>
                            <th style="width: 130px">已核销成团礼</th>
                        {/if}
                        {if $has_invite_gift}
                            <th style="width: 130px">邀请下单</th>
                            <th style="width: 130px">已核销邀请下单礼</th>
                        {/if}
                        {if $has_help_gift}
                            <th style="width: 130px">邀请助力</th>
                            <th style="width: 130px">已核销邀请助力礼</th>
                        {/if}
                        <th style="width: 80px">订单状态</th>
                        <th style="width: 80px">员工</th>
                        <th style="width: 160px;text-align: right">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {loop $list $index $item}
                    <tr>
                        <td>{$item['uid']}</td>
                        <td  style="font-size: 10px;max-width: 100px;">
                            <img src="{php echo tomedia($item['avatar']);}" width="28" style="border-radius: 3px;">
                            <br>
                            {$item['nickname']}
                        </td>
                        <td>{$item['username']}<br/>{$item['mobile']}</td>
                        {if $has_tuan_gift}
                            <td>{$item['tuan_gift']}</td>
                            <td>{$item['tuan_exchange_gift']}</td>
                        {/if}
                        {if $has_invite_gift}
                            <td>{$item['invite_gift']}</td>
                            <td>{$item['invite_exchange_gift']}</td>
                        {/if}
                        {if $has_help_gift}
                            <td>{$item['help_gift']}</td>
                            <td>{$item['help_exchange_gift']}</td>
                        {/if}
                        <td>
                            <span class="label label-{$item['pay_status']['class']}">{$item['pay_status']['txt']}</span>
                            {if !empty($item['pay_status']['bukuan'])}
                            <br><span class="label label-{$item['pay_status']['bukuan_class']}">{$item['pay_status']['bukuan']}</span>
                            {/if}
                        </td>
                        <td>{$item['worker']}</td>
                        <td style="text-align: right">
                            <a href="{php echo createWebUrlPlugin('gift.record.gain',array('themeid'=>$themeid,'uid'=>$item['uid']));}" class="btn btn-warning btn-sm"  title="礼品记录" data-toggle="tooltip" data-placement="top">
                                <i class="fa fa-bar-chart"> </i>
                            </a>
                            <a href="{php echo createWebUrl('fanslog', array('op' => 'display','themeid'=>$themeid, 'uid' => $row['uid']));}" class="btn btn-info btn-sm"  title="日志记录" data-toggle="tooltip" data-placement="top">
                                <i class="fa fa-list"> </i>
                            </a>
                        </td>
                    </tr>
                    {/loop}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

{$pager}
<script type="text/javascript">
    $(document).ready(
        function (){

        }
    );

    function jump(){
        layer.msg('正在准备下载');
    }

    function submitForm(){
        $("#r").val('gift.fans');
        var form = document.getElementById("myform");
        form.submit();
    }

</script>
